#include <iostream>
#include <set>

using namespace std;

typedef long long LL;
const LL INF = 1e10;
set<LL> mp;

int main()
{
    LL q;cin >> q;
    mp.insert(-INF);mp.insert(INF);
    while(q--)
    {
        int op,len; cin >> op >> len;
        if(op == 1)
        {
            if(mp.count(len)) cout << "Already Exist" << endl;
            else mp.insert(len);
        }
        else
        {
            if(mp.size()==2) 
                cout << "Empty" << endl;
            else
            {
                auto t = mp.lower_bound(len);
                auto tmp = t;
                tmp--;
                if(abs(*tmp - len) <= (*t - len))
                {
                    cout << *tmp << endl;
                    mp.erase(*tmp);
                }
                else
                {
                    cout << *t << endl;
                    mp.erase(t);
                }
            }
        }
    }
    return 0;
}